package com.ruyuan.payment.server.enums;

public enum OrderPayStatusEnum {
    INIT("I", "未支付"),
    PENDING("P", "处理中"),
    SUCCESS("S", "支付成功"),
    FAILURE("F", "支付失败"),
    CLOSE("C", "已关闭"),
    PART_REFUND("A", "部分退款"),
    REFUND("R", "已退款");

    private String code;

    private String desc;

    OrderPayStatusEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public String getDesc() {
        return desc;
    }

    public static String getDesc(String code){
        for(OrderPayStatusEnum e: OrderPayStatusEnum.values()){
            if(code.equals(e.getCode())){
                return e.getDesc();
            }
        }
        return  null;
    }
}
